<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:insert="~{include :: header('图片详情')}" />
</head>
<body class="hold-transition">
<div class="container-fluid mt-2 mb-2">

    <form id="form-user-add" class="form-horizontal"  th:object="${bookRequire}">
        <div class="form-group row" th:if="${book != null}">
            <div class="col-12 invoice-info">
                <h4>
                    <i class="fa fa-image"></i> <span th:text="${book.title}"></span>
                    <small class="float-right" th:text="'出版时间：'+${#strings.replace(book.publishDate,'T',' ')}"></small>
                </h4>
            </div>
            <div class="col-12 invoice-info bg-gray-light">
                <label class="col-form-label mr-5">
                    分类：<span class="text-blue" th:text="${book.categoryName}"></span>
                </label>
                <label class="col-form-label mr-5">
                    出版社：<span class="text-blue" th:text="${book.publisher}"></span>
                </label>
                <label class="col-form-label mr-5">
                    书号：<span class="text-blue" th:text="${book.isbn}"></span>
                </label>
                <label class="col-form-label mr-5">
                    装帧：<span class="text-blue" th:text="${book.binding}"></span>
                </label>
            </div>
        </div>
        <div class="form-group row">
            <label class="col-sm-2 text-sm-right col-form-label">学校名称:</label>
            <span class="col-sm-3 col-form-label" th:text="*{schoolName}"></span>
            <label class="col-sm-2 text-sm-right col-form-label">校内职务:</label>
            <span class="col-sm-3 col-form-label" th:text="*{position}"></span>
        </div>
        <div class="form-group row">
            <label class="col-sm-2 text-sm-right col-form-label">联系人:</label>
            <span class="col-sm-3 col-form-label" th:text="*{contacts}"></span>
            <label class="col-sm-2 text-sm-right col-form-label">手机:</label>
            <span class="col-sm-3 col-form-label" th:text="*{mobile}"></span>
        </div>
        <div class="form-group row">
            <label class="col-sm-2 text-sm-right col-form-label">状态:</label>
            <span  th:class="${bookRequire.status == 0?'col-sm-3 col-form-label text-red':'col-sm-3 col-form-label text-blue'}" th:text="${bookRequire.status == 0?'未读':'已读'}"></span>
            <label class="col-sm-2 text-sm-right col-form-label">时间:</label>
            <span class="col-sm-3 col-form-label" th:text="${#strings.replace(bookRequire.createTime,'T',' ')}"></span>
        </div>
        <div class="form-group row">
            <label class="col-sm-2 text-sm-right col-form-label">地址:</label>
            <span class="col-sm-8 col-form-label" th:text="${address}"></span>
        </div>
        <div class="form-group row" th:if="${bookRequire.status > 0}">
            <label class="col-sm-2 text-sm-right col-form-label">备注:</label>
            <span class="col-sm-8 text-red col-form-label" th:text="*{remark}"></span>
        </div>
        <div class="form-group row" th:if="${bookRequire.status == 0}">
            <label class="col-sm-2 col-form-label text-sm-right">备注:</label>
            <div class="col-sm-6">
                <textarea id="remark" name="remark" style="min-height: 100px" class="form-control"></textarea>
                <button type="button" class="btn btn-default btn-xs lang" onclick="$('#remark').text('无用信息')">
                   无用信息
                </button>
            </div>
        </div>
        <div class="row" th:if="${bookRequire.status == 0}">
            <label class="col-sm-2"></label>
            <div class="col-sm-10">
                <button type="button" class="btn btn-primary" onclick="submitSave()"><i class="fa fa-check"></i>保 存</button>&nbsp;
                <button type="button" class="btn btn-danger" onclick="parent.layer.closeAll()"><i class="fa fa-reply-all"></i>关 闭 </button>
            </div>
        </div>
    </form>
</div>
<th:block th:insert="~{include :: footer}" />
<script >
    var prefix = "/book/require";
    var requireId = [[${bookRequire.id}]]
    function submitSave() {
        var remark = $("#remark").val();
        var data = {"id": requireId, "remark": remark};
        $.post(prefix + "/edit.json", data, function (json) {
            console.log(json)
            if (json.code === 0) {
                parent.layer.closeAll();
                parent.$.table.search();
            }else {
                layer.msg(json.msg, {icon: 2});
            }
        })
    }
</script>
</body>
</html>